import java.util.Iterator;
import java.util.Scanner;
import java.util.TreeSet;

public class StudentTreeSet {
    TreeSet<Student> treeSet;
    StudentTreeSet(){
        treeSet = new TreeSet<Student>();
        add();
    }
    public void add(){
        Scanner in = new Scanner(System.in);
        System.out.println("输入学生信息，姓名为#表示结束");
        String name;
        int score;
        while(!(name = in.next()).equals("#")){
            score = in.nextInt();
            treeSet.add(new Student(name,score));
        }
    }
    public void show(){
        Iterator<Student> te =treeSet.iterator();
        while (te.hasNext()){
            Student stu = te.next();
            System.out.println("name："+ stu.name + "Score:" + stu.getScore());
        }
    }
}
